/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.jfonia.view.labels;

import org.jfonia.connect5.basics.BasicValueNode;
import org.jfonia.connect5.basics.MutableValueNode;
import org.jfonia.connect5.basics.ValueNode;
import org.jfonia.connect5.relations.Equal;

/**
 *
 * @author Rik Bauwens
 */
public class Label
{
        private int staffCollectionId;
        private int tick;
        private boolean pre;
        private MutableValueNode<Double> ratioNode;
        private Equal<Double> ratioRelation;

        public Label(int staffCollectionId, int tick, boolean pre)
        {
                this.staffCollectionId = staffCollectionId;
                this.tick = tick;
                this.pre = pre;
                this.ratioNode = new BasicValueNode<Double>(0.0);
        }

        public boolean isPre()
        {
                return pre;
        }

        public int getStaffCollectionId()
        {
                return staffCollectionId;
        }

        public int getTick()
        {
                return tick;
        }

        public double getRatio()
        {
                return ratioNode.getValue();
        }

        public ValueNode<Double> getRatioNode()
        {
                return ratioNode;
        }

        public Label setRatioNode(MutableValueNode<Double> ratioNode)
        {
                if(ratioRelation != null)
                        ratioRelation.switchOff();
                ratioRelation = new Equal<Double>(ratioNode, this.ratioNode);
                return this;
        }
}
